<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<h1>
    <span class="hdr">How to integrate online editors into your own website on .Net (C#) / .Net (C# MVC)</span>
</h1>

<h2>Overview</h2>
<p class="dscr">This example will help you integrate ONLYOFFICE Docs into your web application written in .Net (C#) or .Net (C# MVC).</p>

<div class="note">
    It is intended for testing purposes and demonstrating functionality of the editors.
    <b>DO NOT</b> use this integration example on your own server without proper code modifications.
    In case you enabled the test example, disable it before going for production.
</div>

<h2 id="security" class="copy-link">Important security info</h2>
<p>Please keep in mind the following security aspects when you are using test examples:</p>
<ul>
    <li>There is no protection of the storage from unauthorized access since there is no need for authorization.</li>
    <li>There are no checks against parameter substitution in links, since the parameters are generated by the code according to the pre-arranged scripts.</li>
    <li>There are no data checks in requests of saving the file after editing, since each test example is intended for requests only from ONLYOFFICE Docs.</li>
    <li>There are no prohibitions on using test examples from other sites, since they are intended to interact with ONLYOFFICE Docs from another domain.</li>
</ul>

<h2 id="win-1" class="copy-link"><span class="style_step">Step 1. </span>Install ONLYOFFICE Docs</h2>
<p>Download and install ONLYOFFICE Docs (packaged as Document Server):</p>
<div class="list-buttons">
    <a class="button" href="https://www.onlyoffice.com/download-docs.aspx?from=api#docs-developer" target="_blank">Get ONLYOFFICE Docs</a>
</div>
<p>See the detailed guide to learn how to install ONLYOFFICE Docs <a target="_blank" href="https://helpcenter.onlyoffice.com/installation/docs-developer-install-windows.aspx?from=api_csharp_example">for Windows</a>, <a target="_blank" href="https://helpcenter.onlyoffice.com/installation/docs-developer-install-ubuntu.aspx?from=api_csharp_example">for Linux</a>, or <a target="_blank" href="https://helpcenter.onlyoffice.com/server/developer-edition/docker/docker-installation.aspx?from=api_csharp_example">for Docker</a>.</p>

<h2 id="win-2" class="copy-link"><span class="style_step">Step 2. </span>Download the .Net (C#) / .Net (C# MVC) code for the editors integration</h2>
<p>Download the <a href="<%= Url.Action("demopreview") %>">.Net (C#) or .Net (C# MVC) example</a> from our site.</p>
<p>
    To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the <em>settings.config</em> file
    (or <em>web.appsettings.config</em> file for MVC version):
</p>
<pre>
&lt;add key="storage-path" value=""/&gt;
&lt;add key="files.docservice.url.site" value="https://documentserver/" /&gt;</pre>

<p>where the <b>documentserver</b> is the name of the server with the ONLYOFFICE Docs installed and the <b>storage-path</b> is the path where files will be created and stored. You can set an absolute path.</p>
<p>If you want to experiment with the editor configuration, modify the <a href="<%= Url.Action("advanced") %>">parameters</a> in the <em>DocEditor.aspx</em> file.</p>

<h2 id="win-3" class="copy-link"><span class="style_step">Step 3. </span>Install the prerequisites</h2>
<p>Check that your system meets the requirements:</p>
<ul>
    <li><b>Microsoft .NET Framework</b>: version 4.5 (download it from the <a href="https://www.microsoft.com/en-US/download/details.aspx?id=30653" target="_blank">official Microsoft website</a>);</li>
    <li><b>Internet Information Services</b>: version 7 or later.</li>
</ul>
<p>Configure the IIS components for the server to work correctly:</p>
<ol>
    <li>
        <p>Open Windows features:</p>
        <p><b>Start</b> -> <b>Control Panel</b> -> <b>Programs</b> -> <b>Programs and Features</b> -> <b>Turn Windows features on or off</b></p>
    </li>
    <li>
        <p>In the opened window, find <b>Internet Information Services</b> and check all the features that are chosen in the following image:</p>
        <img class="screenshot" alt="" src="<%= Url.Content("~/content/img/csharp/server-components.png") %>" />
    </li>
</ol>

<h2 id="win-4" class="copy-link"><span class="style_step">Step 4. </span>Run your website with the editors</h2>
<ol>
    <li>
        <p>Run the Internet Information Service (IIS) Manager:</p>
        <p><b>Start</b> -> <b>Control Panel</b> -> <b>System and Security</b> -> <b>Administrative Tools</b> -> <b>Internet Information Services (IIS) Manager</b></p>
    </li>
    <li>
        <p>Add your website in the IIS Manager.</p>
        <p>On the <b>Connections</b> panel right-click the <b>Sites</b> node in the tree, then click <b>Add Website</b>.</p>
        <img class="screenshot" alt="" src="<%= Url.Content("~/content/img/csharp/add.png") %>" />
    </li>
    <li>
        <p>In the <b>Add Website</b> dialog box specify the name of the folder with the .Net (C#) / .Net (C# MVC) project in the <b>Site name</b> box.</p>
        <p>Specify the path to the folder with your project in the <b>Physical Path</b> box.</p>
        <p>Specify the unique value used only for this website in the <b>Port</b> box.</p>
        <img class="screenshot" alt="" src="<%= Url.Content("~/content/img/csharp/sitename.png") %>" />
    </li>
    <li>
        <p>
            Check for the .NET platform version specified in IIS Manager for you website.
            Choose <b>v4.0.</b> version.
        </p>
        <p><b>Application Pools</b> -> right-click the platform name -> <b>Set application Pool defaults</b> -> <b>.NET CLR version</b></p>
        <img class="screenshot" alt="" src="<%= Url.Content("~/content/img/csharp/platform.png") %>" />
    </li>
    <li>
        <p>Browse your website with the IIS Manager:</p>
        <p>Right-click the site -> <b>Manage Website</b> -> <b>Browse</b></p>
        <img class="screenshot" alt="" src="<%= Url.Content("~/content/img/csharp/browse.png") %>" />
    </li>
</ol>

<h2 id="win-5" class="copy-link"><span class="style_step">Step 5. </span>Check accessibility</h2>
<p>
    In case the example and ONLYOFFICE Docs are installed on different computers, make sure that your server with the example installed has access to the ONLYOFFICE Docs with the address which you specify instead of <b>documentserver</b> in the configuration files.
    Make sure that the ONLYOFFICE Docs in its turn has access to the server with the example installed with the address which you specify instead of <b>example.com</b> in the configuration files.
</p>

<p>If you integrated the editors successfully the result should look like the <a href="<%= Url.Action("demopreview") %>#DemoPreview">demo preview</a> on our site.</p>
